<template>
    <div>
        <ul class="mui-table-view">
				<li class="mui-table-view-cell mui-media" v-for="news in newsList" :key="news.id">
					<router-link :to="'/home/newsinfo/' + news.id">
						<img class="mui-media-object mui-pull-left" :src="news.picInfo[0].url">
						<div class="mui-media-body">
							<h1 v-text="news.title"></h1>
							<p class='mui-ellipsis'>
                                <span>发表时间：{{news.ptime}}</span>
                                <span>点击：{{news.tcount}}次</span>
                            </p>
						</div>
					</router-link>
				</li>

			</ul>
    </div>
</template>
<script>
import Mock from 'mockjs'
import {Toast} from 'mint-ui'
export default{
    data(){
        return{
            newsList:[]
        }
    },
    created(){
        this.getNewsList()
    },
    methods:{
        getNewsList(){
            this.$http.get('https://www.apiopen.top/journalismApi')
            .then(result=>{
                //var response = Mock.mock(result.body)
                var response = result.body
                if(response.code == 200){
                    this.newsList = response.data.tech
                    //console.log(this.newsList)
                } else {    
                    Toast('加载新闻列表失败')
                }
            })
        }
    }
}
</script>
<style lang="scss" scoped>
.mui-table-view{
    li{
        h1{
            font-size:14px;
        }
        .mui-ellipsis{
            font-size:12px;
            color:orange;
            display: flex;
            justify-content: space-between;
        }
    }
}
</style>

